
#ifndef __renderableH__
#define __renderableH__

#include "mm.h"
#include "graphicsdata.h"

namespace WtfEngine
{
	/**
	 * Renderable interface
	 * Denotes objects that can be renderered, such that they
	 * can be added to the Renderer's object list
	 **/
	class IRenderable : public virtual IGcObject {
		public:
			virtual void Render() = 0;
			
			GC_INTERFACE(IRenderable);
	};

	/// An object that can be displayed
	class Renderable : public GameObject, public virtual IRenderable
	{
		WtfGraphics::GraphicsData::tCacheRef mrGraphicsData;

	public:
		typedef GcReference<Renderable>	tRef;

		Renderable(const tCreationOptions& args, const WtfGraphics::GraphicsData::tCacheRef& d);
		virtual ~Renderable() {};

		virtual void Render() {
			mrGraphicsData->render();
		};

		WtfGraphics::GraphicsData::tCacheRef getGraphicsData() const {
			return mrGraphicsData;
		};

		void setGraphicsData(const WtfGraphics::GraphicsData::tCacheRef& r) {
			mrGraphicsData = r;
		};
		
		virtual void Destroy();

		virtual unsigned CalculateSerializedSize();
		virtual unsigned Serialize(void * pBuf);
		virtual unsigned Deserialize(void * pBuf);
	};
}

#endif
